package com.cli.apisdk.controller;

import com.cli.apisdk.amapapi.GeoCodeApi;
import com.cli.apisdk.amapapi.PathPlan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: xiongmin
 * @since create by 2022/7/15 18:31
 */
@RestController
@RequestMapping("/amap")
public class AMapController {

    @Autowired
    private GeoCodeApi geoCodeApi;

    @Autowired
    private PathPlan pathPlan;

    @GetMapping("/geo")
    public String geo(@RequestParam("address") String address) {
        String result = geoCodeApi.geo(address);
        return result;
    }

    @GetMapping("/regeo")
    public String regeo(@RequestParam("location") String location) {
        String result = geoCodeApi.regeo(location);
        return result;
    }

    @GetMapping("/path/integrated")
    public String transitIntegrated(@RequestParam("origin") String origin, @RequestParam("destination") String destination, @RequestParam("city") String city, @RequestParam("cityd") String cityd) {
        String result = pathPlan.transitIntegrated(origin,destination,city,cityd);
        return result;
    }
}
